const express = require('express');
const app = express();
const expressWs = require('express-ws')(app);

import { createNewServer } from './utils/createNewServer';
import { createWsServer } from './utils/createWsServer';

const defineRouter = require('./routers/index');
app.use(defineRouter)

app.ws('/', function (ws: any, req: any) {
  createWsServer({}, ws);
  
  // createNewServer({
  //   host: '192.168.2.94',
  //   username: 'megaium',
  //   password: 'Megaium!'
  // }, ws)
});

app.listen(3736,'0.0.0.0', (err:any) => {
  if (err == null) {
    console.log(`start success~~~`);
  } else {
    console.log(`start error~~~` + err.message);
  }

});
